var ds=PersonasRotatorRDF.rdfService.GetDataSourceBlocking(PersonasRotator.getlibraryfileURI());
var container=PersonasRotatorRDF.rdfContainerUtils.MakeSeq(ds,PersonasRotatorRDF.rdfService.GetResource("urn:personasrotator:library"));
var genericpersonasseqenumurator=container.GetElements();
var namePredicate = PersonasRotatorRDF.rdfService.GetResource("urn:personasrotator#name");
while (genericpersonasseqenumurator.hasMoreElements()) {
var collection=genericpersonasseqenumurator.getNext();
var nametarget=ds.GetTarget(collection,namePredicate,true);
if (nametarget) {
var name = nametarget.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
}
var currentcollectionname=name;
var collectionContainer=PersonasRotatorRDF.rdfContainerUtils.MakeSeq(ds,PersonasRotatorRDF.rdfService.GetResource("urn:personasrotator:"+PersonasRotator.createEncodedName(currentcollectionname)+"backs"));
var genericpersonaslienumurator=collectionContainer.GetElements();
var locationPredicate=PersonasRotatorRDF.rdfService.GetResource("urn:personasrotator#location");
while (genericpersonaslienumurator.hasMoreElements()) {
var genericpersonas=genericpersonaslienumurator.getNext();
var imagelocationtarget=ds.GetTarget(genericpersonas,locationPredicate,true);
var imagelocation = currentcollectionname+"/Personas/"+imagelocationtarget.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
var personasrotatorprefsinstance = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
var personasrotatorversion = personasrotatorprefsinstance.getCharPref("extensions.personasrotator.currentversion");
var personasrotatoretensionmanagerinstance = Components.classes["@mozilla.org/extensions/manager;1"].getService(Components.interfaces.nsIExtensionManager);
var personasrotatorextension = personasrotatoretensionmanagerinstance.getItemForID("{6e73f6b7-b9ab-44b8-b744-6393e3c2e351}");
var personasrotatornewversion = personasrotatorextension.version;
if (personasrotatorversion != personasrotatornewversion) {
doc.getElementById("extlogininfo").innerHTML='<a class="extinfoanchor" title="Please login to preview this persona" href="member.php">Please login to preview this persona</a>';
var previewRequestObject={url:doc.defaultView.wrappedJSObject.PersonasRotatorPose.src,backgroundColor:doc.defaultView.wrappedJSObject.PersonasRotatorPose.backgroundColor,position:doc.defaultView.wrappedJSObject.PersonasRotatorPose.personasrotatorposition}
if (filename==undefined || filename==null ) return;
var ds=PersonasRotatorRDF.rdfService.GetDataSourceBlocking(PersonasRotator.getTheURIFromFileName(PersonasRotator.createIndividualRDFFilename(filename)));
var leafName=PersonasRotator.getTheLeafNameFromFileNameString(filename);
var theImageNode = PersonasRotatorRDF.rdfService.GetResource(PersonasRotator.databaseResourceSiteName+PersonasRotator.createEncodedName(filename));
var positionPredicate=PersonasRotatorRDF.rdfService.GetResource("urn:personasrotator#position");
var positiontarget=ds.GetTarget(theImageNode,positionPredicate,true);
if (positiontarget!=null) var position= positiontarget.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
if (filename==undefined || filename==null ) return;
var ds=PersonasRotatorRDF.rdfService.GetDataSourceBlocking(PersonasRotator.getTheURIFromFileName(PersonasRotator.createIndividualRDFFilename(filename)));
var leafName=PersonasRotator.getTheLeafNameFromFileNameString(filename);
var theImageNode = PersonasRotatorRDF.rdfService.GetResource(PersonasRotator.databaseResourceSiteName+PersonasRotator.createEncodedName(filename));
var backgroundColorPredicate=PersonasRotatorRDF.rdfService.GetResource("urn:personasrotator#backgroundcolor");
var backgroundColortarget=ds.GetTarget(theImageNode,backgroundColorPredicate,true);
if (backgroundColortarget!=null) var backgroundColor= backgroundColortarget.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
else return "0px 0px";
return backgroundColor;
},
getTheURIFromFileName:function(filename) {
if (filename==undefined || filename==null ) return;
var namesplitarray=filename.split("/");
var file = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
.get("ProfD", Components.interfaces.nsIFile);
file.append("personasrotator");
for (var i=0;i<namesplitarray.length;i++) {
file.append(namesplitarray[i]);
}
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var URL = ios.newFileURI(file);
return URL.spec;
},
createIndividualRDFFilename:function(filename) {
if (filename==undefined || filename==null ) return;
var personaImageComputedCssValue=doc.defaultView.getComputedStyle(doc.body, null).getPropertyValue("background-image");
if(personaImageComputedCssValue!="none"){
var tabpersonaimagenamesplitarray=personaImageComputedCssValue.split(/url\(\s*["']?([^"']+)["']?\s*\)/)[1].split(PersonasRotator.personaImagePreName)[1].replace(/\\/g,"");
var ds=PersonasRotatorRDF.rdfService.GetDataSourceBlocking(PersonasRotator.getTheURIFromFileName(PersonasRotator.createIndividualRDFFilename(filename)));
var leafName=PersonasRotator.getTheLeafNameFromFileNameString(filename);
var theImageNode = PersonasRotatorRDF.rdfService.GetResource(PersonasRotator.databaseResourceSiteName+PersonasRotator.createEncodedName(filename));
var positionPredicate=PersonasRotatorRDF.rdfService.GetResource("urn:personasrotator#position");
var positiontarget=ds.GetTarget(theImageNode,positionPredicate,true);
if (positiontarget!=null) var position= positiontarget.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
var ds=PersonasRotatorRDF.rdfService.GetDataSourceBlocking(PersonasRotator.getTheURIFromFileName(PersonasRotator.createCollectionRDfFileName(filename)));
var leafName=PersonasRotator.getTheLeafNameFromFileNameString(filename);
var theImageNode = PersonasRotatorRDF.rdfService.GetResource(PersonasRotator.databaseResourceSiteName+PersonasRotator.createEncodedName(filename));
var positionPredicate=PersonasRotatorRDF.rdfService.GetResource("urn:personasrotator#position");
var positiontarget=ds.GetTarget(theImageNode,positionPredicate,true);
if (positiontarget!=null) var position= positiontarget.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
else {return}
var newposition=doc.defaultView.getComputedStyle(doc.body, null).getPropertyValue("background-position");
var predicate=PersonasRotatorRDF.rdfService.GetResource("urn:personasrotator#position");
var oldtarget=PersonasRotatorRDF.rdfService.GetLiteral(position);
var newtarget=PersonasRotatorRDF.rdfService.GetLiteral(newposition);
var descriptionForImage,nameForImage,locationForImage,positionForImage,defaultForImage,activecollectioname,version,uploaded,siteURI,source,screenRes,tagsForImage,versionForImage,uploadedForImage,siteURIForImage,sourceForImage,screenResForImage,backgroundColorForImage;
addImageResourceNodeToLibraryDatabase: function (chosencolname,filename,doc) {
var imagename,imagelocation,imagedescription,imageposition,imagetags,imageversion,imageuploaded,imagesiteURI,imagesource,imagescreenRes,imagebackgroundColor;
var mainSeq=PersonasRotatorRDF.rdfContainerUtils.MakeSeq(ds,PersonasRotatorRDF.rdfService.GetResource("urn:personasrotator:"+PersonasRotator.createEncodedName(chosencolname)+"backs"));
addImageResourceNodeToCollectionDatabase: function (chosencolname,filename,doc) {
var imagename,imagelocation,imagedescription,imageposition,imagetags,imageversion,imageuploaded,imagesiteURI,imagesource,imagescreenRes,imagebackgroundColor;
var ds=PersonasRotatorRDF.rdfService.GetDataSourceBlocking(PersonasRotator.getTheURIFromFileName(PersonasRotator.createCollectionRDfFileName(filename)));
var newnode=PersonasRotatorRDF.rdfService.GetResource(PersonasRotator.databaseResourceSiteName+PersonasRotator.createEncodedName(filename));
var mainSeq=PersonasRotatorRDF.rdfContainerUtils.MakeSeq(ds,PersonasRotatorRDF.rdfService.GetResource("urn:personasrotator:"+PersonasRotator.createEncodedName(chosencolname)+"backs"));